function account() {
    var re = /^[\w]{6,12}$/;
    var account = document.getElementById("xm_account").value;
    if(account.trim().length == 0){
        document.getElementById("sp1").innerHTML = "请输入账号";
    }else if(!re.test(account)){
        document.getElementById("sp1").innerHTML = "账号格式不正确";
    }
}

function login_password() {
    var re = /^[\w]{6,12}$/;
    var password = document.getElementById("xm_password").value;
    if(password.trim().length == 0){
        document.getElementById("sp2").innerHTML = "请输入密码";
    }else if(!re.test(password)){
        document.getElementById("sp2").innerHTML = "密码小于6位数";
    }
}

function butcolor1() {
    var but = document.getElementById("but_denglu");
    but.style.backgroundColor = 'navajowhite';
}
function butcolor2() {
    var but = document.getElementById("but_denglu");
    but.style.backgroundColor = 'sandybrown';
}
function onclicktext() {
    var account = document.getElementById("xm_account").value;
    var password = document.getElementById("xm_password").value;
    var but = document.getElementById("but_denglu");
    if(account.trim().length >0 && password.trim().length >0){
        but.style.backgroundColor = 'orangered';
    }else if(account.trim().length == 0 && password.trim().length == 0){
        but.style.backgroundColor = 'sandybrown';
    }
}

function resetMsg(msgId) {
    document.getElementById(msgId).innerHTML = "";
}

function register1() {
        var xm_account = document.getElementById("xm_account").value;
        var xm_password = document.getElementById("xm_password").value;
        var xm_checkbox = document.getElementById("xm_checkbox");
        if (xm_account != "" && xm_password != "" && xm_checkbox.checked== true){
            return true;
        }else {
            return false;
        }
}